<template>
	<view class="bigBox">
		<view class="title">
			<text class="boxTitle">关于新生入学通知</text>
		</view>
		<view class="newImg"></view>
		<view class="newBox"> 
			<view class="new" v-for="item in news" :key="item.id">
				<view class="newTitle">{{item.title}}</view>
				<view class="newText">{{item.text}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "IndexHeader",
		data() {
			return {
				im:["img1","img2","img3","img4"],
				im2:["img5","img6","img7","img8"],
				im3:["img9","img10","img11"],
				msg:["缴费","选课","成绩","签到"],
				msg2:["2020年插画比赛作品展示","校园摄影大赛作品展示","3D建模比赛作品展示","校园艺术展"],
				news:[],
				schoolNews:[]
			}
		},
		created() {
			this.getNews();
			this.getSchoolNews();
		},
		methods:{
			getNews(){
				uni.request({
					url: 'http://localhost:3000/api/news',
					method: 'GET',
					success: (res) => {
						this.news = res.data.data;
					}
				});
			},
			getSchoolNews(){
				uni.request({
					url: 'http://localhost:3000/api/schoolNews',
					method: 'GET',
					success: (res) => {
						this.schoolNews = res.data.data;
					}
				});
			},
			grade(index){
				if(index === 0 ){
					uni.navigateTo({
						url: '../pay/index'
					});
				}else if(index === 1){
					uni.navigateTo({
						url: 'timetable'
					});
				}else if(index === 2){
					uni.navigateTo({
						url: '../grade/index'
					});
				}
			}
		},
	}
</script>

<style scoped src="../../static/css/home.css"></style>
<style scoped>
	.boxTitle{
		text-align: center;
	}
</style>

